<template>
    <div class="gameManage">
        <el-row :gutter="20">
            <el-col :xs="24" :sm="24" :md="12">
                <el-card class="box-card">
                    <div slot="header" class="header clearfix">
                        <span>上架公告</span>
                    </div>
                    <div v-for="(item,index) in activity_1" :key="index" class="text item clearfix" :class="{warn:item.type==1}">
                        <span class="txt">{{item.content}}</span>
                        <span class="date">{{item.time}}</span>
                    </div>
                    <el-button type="primary" :loading="loadmore" v-show="activityShow" style="width:100%;margin-top:10px;" @click="loadingMore">点击加载更多</el-button>
                </el-card>
            </el-col>
            <el-col :xs="24" :sm="24" :md="12">
                <el-card class="box-card">
                    <div slot="header" class="header clearfix">
                        <span>活动公告</span>
                    </div>
                    <div v-for="(item,index) in activity_2" :key="index" class="text item clearfix" :class="{warn:item.type==1}">
                        <span class="txt">{{item.content}}</span>
                        <span class="date">{{item.time}}</span>
                    </div>
                     <el-button type="primary" :loading="false"  style="width:100%;margin-top:10px;" >点击加载更多</el-button>
                </el-card>
            </el-col>
        </el-row>
    </div>
</template>

<script>
    export default {
        name:'gameManage',
        data(){
            return{
                loadmore:false,
                pagesize:5,
                page:1,
                activity_1:[],
                activity_2:[],
                down:false,
                activityShow:true,
                notice:[
                    {
                        content:'【IOS用户补偿方案】IOS端已全部恢复完毕，补偿奖励如下】',
                        time:'07-20',
                        type:'0'
                    },{
                        content:'【7.17-7.23周推荐】一周流水排行榜 新游上线开服表】',
                        time:'07-25',
                        type:'0'
                    },{
                        content:'【重要通知】游戏盒子临时维护，暂时下架。部分玩家无法登陆游戏请联系客服',
                        time:'07-30',
                        type:'1'
                    },{
                        content:'【IOS用户补偿方案】IOS端已全部恢复完毕，补偿奖励如下】',
                        time:'07-20',
                        type:'0'
                    },{
                        content:'【7.17-7.23周推荐】一周流水排行榜 新游上线开服表】',
                        time:'07-25',
                        type:'0'
                    },{
                        content:'【重要通知】游戏盒子临时维护，暂时下架。部分玩家无法登陆游戏请联系客服',
                        time:'07-30',
                        type:'1'
                    },{
                        content:'【IOS用户补偿方案】IOS端已全部恢复完毕，补偿奖励如下】',
                        time:'07-20',
                        type:'0'
                    },{
                        content:'【7.17-7.23周推荐】一周流水排行榜 新游上线开服表】',
                        time:'07-25',
                        type:'0'
                    },{
                        content:'【重要通知】游戏盒子临时维护，暂时下架。部分玩家无法登陆游戏请联系客服',
                        time:'07-30',
                        type:'1'
                    },{
                        content:'【IOS用户补偿方案】IOS端已全部恢复完毕，补偿奖励如下】',
                        time:'07-20',
                        type:'0'
                    },{
                        content:'【7.17-7.23周推荐】一周流水排行榜 新游上线开服表】',
                        time:'07-25',
                        type:'0'
                    },{
                        content:'【重要通知】游戏盒子临时维护，暂时下架。部分玩家无法登陆游戏请联系客服',
                        time:'07-30',
                        type:'1'
                    },{
                        content:'【IOS用户补偿方案】IOS端已全部恢复完毕，补偿奖励如下】',
                        time:'07-20',
                        type:'0'
                    },{
                        content:'【7.17-7.23周推荐】一周流水排行榜 新游上线开服表】',
                        time:'07-25',
                        type:'0'
                    },{
                        content:'【重要通知】游戏盒子临时维护，暂时下架。部分玩家无法登陆游戏请联系客服',
                        time:'07-30',
                        type:'1'
                    },{
                        content:'【IOS用户补偿方案】IOS端已全部恢复完毕，补偿奖励如下】',
                        time:'07-20',
                        type:'0'
                    },{
                        content:'【7.17-7.23周推荐】一周流水排行榜 新游上线开服表】',
                        time:'07-25',
                        type:'0'
                    },{
                        content:'【重要通知】游戏盒子临时维护，暂时下架。部分玩家无法登陆游戏请联系客服',
                        time:'07-30',
                        type:'1'
                    }
                ]
            }
        },
        created(){
            this.activity_1=this.notice.slice(0,this.pagesize);
            this.activity_2=this.notice.slice(0,this.pagesize);
        },
        methods:{
            loadingMore(){
                if(this.down=='ture'){
                    return;
                }else{
                    this.loadmore=true;
                    this.down=true;
                    this.page+=1;
                    setTimeout(()=>{
                        this.activity_1=this.notice.slice(0,this.page*this.pagesize);
                        if(this.activity_1.length==this.notice.length){
                            this.activityShow=false;
                        }
                        this.loadmore=false;
                        this.down=false;
                    },500)
                }
            }
        }
    }
</script>

<style scoped lang="scss">
    .box-card{
        text-align:left;
        .header{
            span{
                font-size:16px;
                font-weight:bold;
            }
        }
        .text{
            border-bottom:1px solid #ddd;
            line-height:50px;
            color:#337ab7;
            cursor:pointer;
            font-size:14px;
            .txt{
                float:left;
            }
            .date{
                float:right;
            }
        }
        .warn{
            color:red;
        }
    }
</style>